package cbfg.common.webview;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.view.KeyEvent;
import android.webkit.ConsoleMessage;
import android.webkit.PermissionRequest;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;

/**
 * @Description: 类作用描述
 * @Author: TomHawk
 * @CreateDate: 5/27/2024 10:42 AM
 * @UpdateUser: TomHawk
 * @UpdateDate: 5/27/2024 10:42 AM
 * @UpdateRemark:
 */
interface WebHook {
    void onWebInit(WebView webView);

    boolean shouldOverrideUrlLoading(WebView webView, String url);

    void onPageFinished(WebView webView, String url);

    void onReceivedTitle(WebView webView, String title);

    void onProgressChanged(WebView webView, int newProgress);

    void onPageStarted(WebView webView, String url, Bitmap favicon);

    boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                              WebChromeClient.FileChooserParams fileChooserParams);

    boolean onActivityResult(int requestCode, int resultCode, Intent intent);

    void onReceivedError(WebView webView, WebResourceRequest request, WebResourceError error);

    WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request);

    boolean onBackPressed();

    boolean onKeyUp(int keyCode, KeyEvent event);

    void onConsoleMessage(ConsoleMessage consoleMessage);

    void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error);

    void onReceivedError(WebView webView, String url, int errorCode, String description);

    void onPermissionRequest(PermissionRequest request);
}
